/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.apache.shenyu.plugin.httpclient.config;

import java.util.List;

public class DuplicateResponseHeaderProperties {
    
    /**
     * Duplicate response headers.
     */
    private List<String> headers;
    
    /**
     * Duplicate response headers handle strategy.
     */
    private DuplicateResponseHeaderStrategy strategy = DuplicateResponseHeaderStrategy.RETAIN_FIRST;
    
    /**
     * Gets duplicate response headers.
     *
     * @return duplicate response headers
     */
    public List<String> getHeaders() {
        return headers;
    }
    
    /**
     * Sets duplicate response headers.
     *
     * @param headers duplicate response headers
     */
    public void setHeaders(final List<String> headers) {
        this.headers = headers;
    }
    
    /**
     * Gets duplicate response headers handle strategy.
     *
     * @return duplicate response headers handle strategy
     */
    public DuplicateResponseHeaderStrategy getStrategy() {
        return strategy;
    }
    
    /**
     * Sets duplicate response headers handle strategy.
     *
     * @param strategy strategy
     */
    public void setStrategy(final DuplicateResponseHeaderStrategy strategy) {
        this.strategy = strategy;
    }
    
    /**
     * Gets duplicate response headers handle strategy.
     */
    public enum DuplicateResponseHeaderStrategy {
        
        /**
         * Default: Retain the first value only.
         */
        RETAIN_FIRST,
        
        /**
         * Retain the last value only.
         */
        RETAIN_LAST,
        
        /**
         * Retain all unique values in the order of their first encounter.
         */
        RETAIN_UNIQUE
    }
}
